import API from '@/api'
import {notification} from 'ant-design-vue'

const changeStatus = (callback, isInterview, status, ext1, ext2) => {
    const params = {isInterview, status}
    const isObj = ext1.constructor === Object
    params.resumeIds = isObj ? ext1.keys : ext1
    if (ext2) {
        if (isInterview) params.interviewId = ext2
        else params.signTime = ext2
    }
    API.Resume.ChangeStatus(params).then((res) => {
        if (res) {
            if (isObj) ext1.visible1 = ext1.visible2 = false
            ext1.visible1 = ext1.visible2 = false
            notification.success({
                message: '提示',
                description: '操作成功'
            });
            callback(isInterview && status === 0 ? params.resumeIds : false)
        }
    }).finally(() => {
        if (isObj) ext1.loading = false
    })
}

export default changeStatus
